from collections import deque


class StockSpanner:

    def __init__(self):
        self.prices = deque()

    def next(self, price: int) -> int:
        ret = 1
        for p in self.prices:
            if p <= price:
                ret += 1
            else:
                break
        self.prices.appendleft(price)
        return ret

